function clsbox() {
    hdaper();
}
function shaper() {
    $(".hdaper .panel").addClass('tpshow');
    $('.paper-bg').show();
}

function hdaper() {
    $(".hdaper .panel").removeClass('tpshow');
    $('.paper-bg').hide();
}
$CertusFormAjax.ajax("findApliNode",{"processId":processId},function (response) {
    var data = response.data;
    var appList = data.appMap;
    var sList = data.sMap;
    var eList = data.eMap;
    var html="";
    var dlength = appList.length;
    var isFinish=false;
    //子流程是否结束
    var isCld = true;
    var jl=0;
    var yblName="";
    for(var i=0;i<dlength;i++){
        var nodeStr="";
        html+='<div class="proce-log"><div class="proce-log-lf"><div class="log-dashed"></div>' +
            '</div><div class="proce-log-rg"><div class="log-mark">';
        if (appList[i].nodeFlag==1){
            html+='<div class="log-mark-icon mark-prime">发起';
            nodeStr+='&nbsp;&nbsp;&nbsp;&nbsp;出差申请';
        }else if (appList[i].nodeFlag == 3){
            html+='<div class="log-mark-icon mark-warning">退回';
            nodeStr+='&nbsp;&nbsp;&nbsp;&nbsp;申请退回';
        }else if (appList[i].nodeFlag == 4){
            html+='<div class="log-mark-icon mark-success">同意';
            nodeStr+='&nbsp;&nbsp;&nbsp;&nbsp;审批通过';
        }else if (appList[i].nodeFlag == 5) {
            html += '<div class="log-mark-icon mark-danger">取消';
            nodeStr += '&nbsp;&nbsp;&nbsp;&nbsp;取消申请';
            isFinish = true;
        }else if (appList[i].nodeFlag == 8) {
            html += '<div class="log-mark-icon mark-prime">提交';
            nodeStr += '&nbsp;&nbsp;&nbsp;&nbsp;提交出差结果';
            //拼接子流程
        }else if (appList[i].nodeFlag == 10) {
            html += '<div class="log-mark-icon mark-success">同意';
            nodeStr += '&nbsp;&nbsp;&nbsp;&nbsp;审批通过';
        }else{
            html+='<div class="log-mark-icon mark-prime">提交';
            nodeStr+='&nbsp;&nbsp;&nbsp;&nbsp;出差汇总';
        }
        html+='</div><div class="log-tag"></div><div class="log-mark-value"><div class="log-mtitle">' +
            '<span class="log-time">'+appList[i].createTime;
        html+=nodeStr;
        html+='</span><span class="log-status">状态：';

        if (appList[i].nodeFlag==5){
            //流程走完正常结束
            html+='流程结束<i class="status-red">';
        }else{
            html+='任务执行完毕<i>';
        }

        html+='</i></span></div><div class="log-mbody"><span class="log-name">办理人：';
        html+=appList[i].createUser;
        html += '</span>';
        html+='</div></div></div></div></div>';

        if (appList[i].nodeFlag==1){
            for (var j=0;j<sList.length;j++){
                //拼接子流程项目审批的信息
                var nodeStr1="";
                // html+='<h5 class="tp-title"><span>出差审批流程</span></h5>';
                html+='<div class="proce-log"><div class="proce-log-lf"><div class="log-dashed"></div>' +
                    '</div><div class="proce-log-rg"><div class="log-mark">';
                if (sList[j].nodeFlag==1){
                    html+='<div class="log-mark-icon mark-prime">发起';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'出差申请';
                }else if (sList[j].nodeFlag==2){
                    html+='<div class="log-mark-icon mark-danger">拒绝';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'申请不通过';
                }else if (sList[j].nodeFlag == 3){
                    html+='<div class="log-mark-icon mark-warning">退回';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'申请退回';
                }else if (sList[j].nodeFlag == 4){
                    html+='<div class="log-mark-icon mark-icon">结束';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'审批通过';
                }else if (sList[j].nodeFlag == 5){
                    html+='<div class="log-mark-icon mark-danger">取消';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'取消申请';
                }else if (sList[j].nodeFlag == 6){
                    html+='<div class="log-mark-icon mark-prime">提交';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'提交出差结果';
                }else if (sList[j].nodeFlag == 0){
                    html+='<div class="log-mark-icon mark-prime">同意';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'同意申请';
                }else{
                    html+='<div class="log-mark-icon mark-icon">结束';
                    nodeStr1='&nbsp;&nbsp;&nbsp;&nbsp;'+sList[j].proName+'审批通过';
                }
                html+='</div><div class="log-tag"></div><div class="log-mark-value"><div class="log-mtitle">' +
                    '<span class="log-time">'+sList[j].createTime;
                html+=nodeStr1;
                html+='</span><span class="log-status">状态：';

                if (sList[j].nodeFlag==7||sList[j].nodeFlag==5||sList[j].nodeFlag==4){
                    //流程走完正常结束
                    html+='项目流程结束<i class="status-red">';
                }else{
                    html+='任务执行完毕<i>';
                }

                html+='</i></span></div><div class="log-mbody"><span class="log-name">办理人：';
                html+=sList[j].createUser;
                html += '</span></div></div></div></div></div>';
            }
        }
        if (appList[i].nodeFlag==8){
            //拼接子流程项目审批的信息
            for (var j=0;j<eList.length;j++){
                var nodeStr1="";
                if (eList[j].nodeFlag<7){
                    jl++;
                }
                // html+='<h5 class="tp-title"><span>出差结果审批</span></h5>';
                html+='<div class="proce-log"><div class="proce-log-lf"><div class="log-dashed"></div>' +
                    '</div><div class="proce-log-rg"><div class="log-mark">';
                if (eList[j].nodeFlag==1){
                    html+='<div class="log-mark-icon mark-prime">发起';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'出差申请';
                }else if (eList[j].nodeFlag==2){
                    html+='<div class="log-mark-icon mark-danger">拒绝';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'申请不通过';
                }else if (eList[j].nodeFlag == 3){
                    html+='<div class="log-mark-icon mark-warning">退回';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'申请退回';
                }else if (eList[j].nodeFlag == 4){
                    html+='<div class="log-mark-icon mark-success">同意';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'审批通过';
                }else if (eList[j].nodeFlag == 5){
                    html+='<div class="log-mark-icon mark-danger">取消';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'取消申请';
                }else if (eList[j].nodeFlag == 6){
                    html+='<div class="log-mark-icon mark-prime">提交';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'提交出差结果';
                }else if (eList[j].nodeFlag == 7){
                    html+='<div class="log-mark-icon mark-icon">结束';
                    nodeStr1+='&nbsp;&nbsp;&nbsp;&nbsp;'+eList[j].proName+'出差结果审批通过';
                    jl--;
                    yblName +=","+eList[j].createUser+"("+eList[j].createUserId+")";
                }
                html+='</div><div class="log-tag"></div><div class="log-mark-value"><div class="log-mtitle">' +
                    '<span class="log-time">'+eList[j].createTime;
                html+=nodeStr1;
                html+='</span><span class="log-status">状态：';

                if (eList[j].nodeFlag==7||eList[j].nodeFlag==5){
                    //流程走完正常结束
                    html+='结果流程结束<i class="status-red">';
                }else{
                    html+='任务执行完毕<i>';
                }

                html+='</i></span></div><div class="log-mbody"><span class="log-name">办理人：';
                html+=eList[j].createUser;
                html += '</span></div></div></div></div></div>';
            }
        }
    }

    //审批结果是否全部通过
    if (jl<0){
        //全部通过
        isCld=false;
        isFinish = true;
    }
    //如果未正常结束
    if (isFinish==false&&isCld){
        // html+='<h5 class="tp-title"><span>出差结果审批</span></h5>';
        html+='<div class="proce-log"><div class="proce-log-lf"><div class="log-dashed"></div>' +
            '</div><div class="proce-log-rg"><div class="log-mark">';
        html+='<div class="log-mark-icon mark-blue">待办';
        html+='</div><div class="log-tag"></div><div class="log-mark-value"><div class="log-mtitle">' +
            '<span class="log-time">'+appList[dlength-1].createTime;
        html+='&nbsp;&nbsp;&nbsp;&nbsp;等待办理';
        html+='</span><span class="log-status">状态：';
        html+='流程执行中<i class="status-purple">';

        html+='</i></span></div><div class="log-mbody"><span class="log-name">办理人：';
        var delUser="";
        if (yblName==""){
            delUser = appList[dlength-1].delUser;
        }else{
            delUser = ","+appList[dlength-1].delUser;
        }
        delUser = delUser.replace(yblName,"");
        if (delUser!=""){
            delUser = delUser.substring(1,delUser.length);
        }
        html+=delUser;
        html += '</span>';
        html+='</div></div></div></div></div>';
    }
    $("#nodeContiner").html(html);
});